﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NationalD3.Domain.Validations.Students;

namespace NationalD3.Domain.Commands.Students
{
    /// <summary>
    /// 创建学生命令模型类
    /// </summary>
    public class RegisterStudentCommand : StudentCommand
    {
        /// <summary>
        /// 构造方法
        /// </summary>
        public RegisterStudentCommand(string name, string email, DateTime birthDate, string phone,string province, string city, string county, string street)
        {
            this.Name = name;
            this.Email = email;
            this.BirthDate = birthDate;
            this.Phone = phone;
            this.Province = province;
            this.City = city;
            this.County = county;
            this.Street = street;
        }


        /// <summary>
        /// 实现基类抽象方法, 验证模型是否有效
        /// </summary>
        /// <returns></returns>
        public override bool IsValid()
        {
            ValidationResult = new RegisterStudentCommandValidation().Validate(this);
            return ValidationResult.IsValid;
        }
    }
}
